//
//  RBGoodsOrderAppraiseVC.m
//  zhongzhenglu
//
//  Created by XL on 2022/8/15.
//

#import "RBGoodsOrderAppraiseVC.h"
#import "RBDefine.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>
#import "RanTool.h"
#import "RBTextView.h"
#import "RBGoodsOrderStarView.h"
#import "RBGrowablePhotoContainer.h"

@interface RBGoodsOrderAppraiseVC ()

@property(nonatomic, strong)UIScrollView *scrollView;

@end

@implementation RBGoodsOrderAppraiseVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
}

#pragma mark - Private

- (void)setup
{
    self.title = @"发表评价";
    self.view.backgroundColor = [RBThemeConfig bgGrayColor];
    
    [self.scrollView rbSetContentWidth:kRBMainScreenWidth];
    [self.scrollView addView:({
        UIView *view = UIView.new;
        view.backgroundColor = UIColor.whiteColor;
        [view rbSetCornerRadius:Zoom(8)];
        
        [view view_addView:({
            UIView *view = UIView.new;
            
            UIImageView *imgView = [RanTool imgViewWithMode:2 radius:Zoom(8) imgName:@"b1.jpg"];
            [view addSubview:imgView];
            [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.top.mas_equalTo(0);
                make.width.height.mas_equalTo(Zoom(97));
            }];
            
            UILabel *nameL = [RanTool labelWithFontSize:Zoom(15) weight:2 color:[RBThemeConfig textBlackColor] align:0 text:@"沪鸽凯晶塑钢牙合成树脂牙全口假牙..."];
            nameL.numberOfLines = 2;
            [view addSubview:nameL];
            [nameL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(imgView.mas_right).offset(Zoom(22));
                make.top.mas_equalTo(Zoom(7));
                make.right.mas_equalTo(0);
            }];
            
            UILabel *priceL = UILabel.new;
            [view addSubview:priceL];
            [priceL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(nameL);
                make.top.mas_equalTo(nameL.mas_bottom).offset(Zoom(Zoom(24)));
            }];
            priceL.attributedText = [RanTool attributeStringMaker:^(NSMutableArray *maker) {
                [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(11) weight:UIFontWeightMedium] color:[RBThemeConfig priceRedColor] string:@"￥"];
                [maker addAttributeStringWithFont:[UIFont systemFontOfSize:Zoom(16) weight:UIFontWeightMedium] color:[RBThemeConfig priceRedColor] string:@"500.00"];
            }];
            
            view;
        }) withHeight:Zoom(97) width:CGFLOAT_MIN top:Zoom(21) bottom:0 left:Zoom(16) right:Zoom(16) centerX:0];
        
        RBGoodsOrderStarView *startView = RBGoodsOrderStarView.new;
        [view view_addView:({
            UIView *view = UIView.new;
            
            UILabel *starL = [RanTool labelWithFontSize:Zoom(14) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:@"商品评分"];
            [view addSubview:starL];
            [starL mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.top.bottom.mas_equalTo(0);
            }];
            
            [view addSubview:startView];
            [startView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.mas_equalTo(starL.mas_right).offset(Zoom(11));
                make.centerY.mas_equalTo(0);
                make.size.mas_equalTo(startView.suggestSize);
            }];
            
            view;
        }) withHeight:startView.suggestSize.height width:CGFLOAT_MIN top:Zoom(14) bottom:0 left:Zoom(16) right:Zoom(16) centerX:0];
        
        [view view_addView:({
            RBTextView *textView = RBTextView.new;
            textView.font = [UIFont systemFontOfSize:Zoom(14)];
            textView.textColor = [RBThemeConfig textBlackColor];
            textView.placeHolder = @"商品怎么样？说说体验心得吧~";
            textView.placeHolderColor = [UIColor colorWithHexString:@"#A2A2A2"];
            textView.placeHolderFontSize = Zoom(14);
            textView;
        }) withHeight:Zoom(110) width:CGFLOAT_MIN top:Zoom(20) bottom:0 left:Zoom(16)-3 right:Zoom(16)-3 centerX:0];
        
        CGFloat photoW = Zoom(264);
        RBGrowablePhotoContainer *photoView = [RBGrowablePhotoContainer viewWithMaxNum:9 colNum:3 editable:YES viewWidth:photoW];
        [view view_addView:photoView withHeight:photoView.viewHeight width:photoW top:Zoom(20) bottom:Zoom(20) left:Zoom(16) right:CGFLOAT_MIN centerX:0];
        
        view;
    }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:Zoom(10) bottom:Zoom(10) left:Zoom(13) right:Zoom(13) centerX:0];
    
}

#pragma mark - Network

#pragma mark - Event

#pragma mark - Setter

#pragma mark - Getter

- (UIScrollView *)scrollView
{
    if (!_scrollView)
    {
        self.scrollView = ({
            UIScrollView *view = UIScrollView.new;
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.mas_equalTo(0);
            }];
            view;
        });
    }
    return _scrollView;
}

@end
